const fs = require('fs');
const path = require('path');

const docsDir = path.join(__dirname, '../docs');
const tsDir = path.join(docsDir, 'typescript-docs');
const vueDir = path.join(docsDir, 'vue-component-docs');

// 确保目录存在
[tsDir, vueDir].forEach(dir => {
  if (!fs.existsSync(dir)) {
    fs.mkdirSync(dir);
  }
});

// 移动TypeScript文档
['typescript-guide.md', 'typescript-exercises.md'].forEach(file => {
  const src = path.join(docsDir, file);
  const dest = path.join(tsDir, file);
  if (fs.existsSync(src)) {
    fs.renameSync(src, dest);
    console.log(`Moved ${file} to typescript-docs`);
  }
});

// 移动Vue组件文档
const vueDocs = [
  'component-creation-guide.md',
  'component-communication.md',
  'component-design-patterns.md',
  'component-library-guide.md',
  'theme-customization-guide.md',
  'i18n-a11y-guide.md',
  'component-testing-guide.md',
  'component-documentation-guide.md',
  'learning-path.md',
  'USAGE-GUIDE.md',
  'DEVELOPMENT-SETUP.md',
  'DOCUMENTATION-TREE.md'
];

vueDocs.forEach(file => {
  const src = path.join(docsDir, file);
  const dest = path.join(vueDir, file);
  if (fs.existsSync(src)) {
    fs.renameSync(src, dest);
    console.log(`Moved ${file} to vue-component-docs`);
  } else {
    console.log(`File not found: ${file}`);
  }
});

console.log('Document reorganization completed!');